import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { DrivecarVO, DrivecarForm, DrivecarQuery } from '@/api/wuliu/drivecar/types';

/**
 * 查询发车表列表
 * @param query
 * @returns {*}
 */

export const listDrivecar = (query?: DrivecarQuery): AxiosPromise<DrivecarVO[]> => {
  return request({
    url: '/wuliu/drivecar/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询发车表详细
 * @param id
 */
export const getDrivecar = (id: string | number): AxiosPromise<DrivecarVO> => {
  return request({
    url: '/wuliu/drivecar/' + id,
    method: 'get'
  });
};

/**
 * 新增发车表
 * @param data
 */
export const addDrivecar = (data: DrivecarForm) => {
  return request({
    url: '/wuliu/drivecar',
    method: 'post',
    data: data
  });
};

/**
 * 修改发车表
 * @param data
 */
export const updateDrivecar = (data: DrivecarForm) => {
  return request({
    url: '/wuliu/drivecar',
    method: 'put',
    data: data
  });
};

/**
 * 删除发车表
 * @param id
 */
export const delDrivecar = (id: string | number | Array<string | number>) => {
  return request({
    url: '/wuliu/drivecar/' + id,
    method: 'delete'
  });
};
